package Chess_Flyweight_12;

public class ChessApplication {
    public static void main(String[] args) {
        ChessPiece white1 = ChessFactory.getChessPiece("白");
        ChessPiece black1 = ChessFactory.getChessPiece("黑");
        ChessPiece white2 = ChessFactory.getChessPiece("白");

        white1.display(1, 2);
        black1.display(3, 4);
        white2.display(5, 6);

        if (white1 == white2) {
            System.out.println("white1 和 white2 指向同一个对象");
        } else {
            System.out.println("white1 和 white2 指向不同的对象");
        }
    }
}
